
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.net.Socket;

/**
 *
 * @author hussein
 */
public class EventConnection {

    enum STATE {

        REQ, DATA, RESPONSE
    }
    
    public BufferedInputStream fromClient;
    public BufferedOutputStream toClient;
    public Socket client;
    public STATE state;
    public HTTPRequest request;
    public byte[] buffer;
    public EventConnection(Socket socket) {
        this.client = socket;
    }

    public void openStreams() {
        try {
            fromClient = new BufferedInputStream(client.getInputStream());
            toClient = new BufferedOutputStream(client.getOutputStream());
        } catch (IOException ex) {
            System.out.println(ex);
        }
    }

    public void closeConnection() {
        try {
            client.close();
        } catch (IOException ex) {
            System.out.println(ex);
        }
    }
}
